package LeetCode;

import seqlist.LeetCode.面试题_Num02_04_partition;

import java.util.HashMap;
import java.util.HashSet;

//41. 缺失的第一个正数
public class Num_41_firstMissingPositive {
    public int firstMissingPositive(int[] nums) {

        HashSet<Integer> set = new HashSet<>();

        for (int i = 0; i < nums.length; i++) {
            set.add(nums[i]);
        }

        for (int i = 1; ; i++) {
            boolean is = set.add(i);
            if(is == true){
                return i;
            }
        }

    }

    public static void main(String[] args) {
        Num_41_firstMissingPositive aa = new Num_41_firstMissingPositive();
      int a  =  aa.firstMissingPositive(new int[]{1,2,0});
        System.out.println(a);
    }
}
